using System;
using System.Collections.Generic;
using System.Text;

using NUnit.Framework;
using Rhino.Mocks;

using MCromwell.StaffIntranet.Core;
using MCromwell.StaffIntranet.DTO;
using MCromwell.StaffIntranet.DependencyInjection;
using MCromwell.StaffIntranet.Task.Infrastructure.Logging;
using MCromwell.StaffIntranet.Data.NHibernate;

using MCromwell.BDD;
using MCromwell.StaffIntranet.Task;

namespace MCromwell.StaffIntranet.DependencyInjection.Test
{
    [TestFixture]
    [Category("Presenter Layer Integration")]
    public class When_resolving_task_layer_dependencies : Specification
    {
        [Test]
        public void Should_returned_correct_log_when_asked_to_resolve()
        {
            
            ILog log = IoC.Resolve<ILog>();

            Assert.IsInstanceOfType(typeof(Log4NetLog), log);
        }

        [Test]
        public void Should_returned_correct_repositories_when_asked_to_resolve()
        {
            
            IStaffRepository staffRepository = IoC.Resolve<IStaffRepository>();
            ILookupRepository lookupRepository = IoC.Resolve<ILookupRepository>();
            IAdministrationRepository adminRepository = IoC.Resolve<IAdministrationRepository>();

            Assert.IsInstanceOfType(typeof(NHibernateStaffRepository), staffRepository, "staff repository");
            Assert.IsInstanceOfType(typeof(NHibernateLookupRepository), lookupRepository, "lookup repository");
            Assert.IsInstanceOfType(typeof(NHibernateAdministrationRepository), adminRepository, "administrator repository");
        }

        public override void Before_each_spec()
        {
            
        }

        [TestFixtureSetUp]
        public void TextFixtureSetup()
        {
            IoC.InitializeWith(new ServiceResolver());
            TaskLayerBootStrapper.ConfigureDependencies();
        }
       
    }
               
}
